package tuanda.soict.firstsun.ClickListenerPackage;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ClickListener;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;

public class ChangePlayerClickListener implements ClickListener {

	private int maxValue;
	private int currentValue;
	private TextButton textButton;

	public ChangePlayerClickListener(int max, TextButton button) {
		setMaxValue(max);
		setCurrentValue(0);
		textButton = button;
	}

	@Override
	public void click(Actor actor, float x, float y) {
		currentValue++;
		currentValue = currentValue % maxValue;
		if (currentValue == 0) {
			textButton.setText("PLAYER");
		} else if (currentValue == 1) {
			textButton.setText("COMP");
		} else if (currentValue == 2) {
			textButton.setText("NONE");
		}
	}

	public int getMaxValue() {
		return maxValue;
	}

	public void setMaxValue(int maxValue) {
		this.maxValue = maxValue;
	}

	public int getCurrentValue() {
		return currentValue;
	}

	public void setCurrentValue(int currentValue) {
		this.currentValue = currentValue;
	}
}
